package ch7;

import java.io.*;
import java.util.Arrays;

import ch3.Sex;
import ch3.Student;

public class GetObjectArray {

	public static void main(String[] args) throws IOException {
		Student st = new Student("laowu", Sex.女);
		// 得到对象st的byte数组
		// 写到文件，再读粗来
		ByteArrayOutputStream out = new ByteArrayOutputStream();
		ObjectOutputStream oout = new ObjectOutputStream(out);
		oout.writeObject(st);
		oout.close();

		byte[] br = out.toByteArray();
		System.out.println(Arrays.toString(br));
	}

}
